﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WindowControlLib;

namespace ECCSystem
{
    public partial class frm_Ext_MerchandiseList : Form
    {
        private IList<string> NoList;

        public frm_Ext_MerchandiseList(IList<string> pNoList)
        {
            InitializeComponent();
            this.NoList = pNoList;
        }

        private void frm_Ext_MerchandiseList_Load(object sender, EventArgs e)
        {
            this.listBox1.DataSource = NoList;
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string vMerchandiseNo = this.listBox1.Text;

            Clipboard.SetText(vMerchandiseNo);

            MerchandiseSearch _merchandiseSearch = new MerchandiseSearch();

            this.Enabled = false;
            bool res = false;
            try
            {
                res =
                    _merchandiseSearch.Search(vMerchandiseNo);
            }
            catch (Exception ex)
            {

                if (ex.Message.Contains("TimeOut"))
                    MessageBox.Show("查询超时，请重新打开查询画面！");
            }


            if (!res)
            {
                MessageBox.Show("请检查CSC工具是否打开到查询画面！");
            }

            this.Enabled = true;
        }


    }
}
